

import Vue from 'vue';
import VueAwesomeSwiper from 'vue-awesome-swiper';
import 'swiper/css/swiper.css';
import 'quill/dist/quill.core.css';
import 'quill/dist/quill.snow.css';
import 'quill/dist/quill.bubble.css';
import './web/filters'

Vue.config.productionTip = false;

Vue.use(VueAwesomeSwiper);
Vue.prototype.$baseImgUrl = `${process.env.BASE_URL}static/img/`;

const createVue = (router, store, App) => {
  new Vue({
    router,
    store,
    render: (h) => h(App),
  }).$mount('#app');
};

const getDefault = (moduleArr) => moduleArr[0].map((module) => module.default);
const isMobile = /(iPhone|iPad|iPod|ios|Android)/i.test(navigator.userAgent);
if (isMobile) {
  Promise.all([
    import('./mobile/router'),
    import('./mobile/store'),
    import('./mobile/App.vue'),
  ]).then((...args) => {
    createVue(...getDefault(args));
  });
} else {
  Promise.all([
    import('./web/router'),
    import('./web/store'),
    import('./web/App.vue'),
  ]).then((...args) => {
    createVue(...getDefault(args));
  });
}
